package com.linkstec;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class ThreadTest2 {
/**
 * 线程传参
 * @param args
 */
	 public static void main(String[] args) {
		 
		 ExecutorService executors = Executors.newFixedThreadPool(10);
		 
		 Map<String, String> input1 = new HashMap<String, String>();
		 input1.put("fuckyou1", "fuck1");
		 input1.put("enentIds", "1,2,3");
		 Map<String, String> input2 = new HashMap<String, String>();
		 input2.put("fuckyou2", "fuck2");
		 input2.put("enentIds", "22,22,222");
		 executors.execute(new Thread1(input1));
		 executors.execute(new Thread1(input2));
		 executors.shutdown();
		 try {
			executors.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
//	     new Thread(new Thread1(input1)).start();
//	     new Thread(new Thread1(input2)).start();
	     System.out.println("ThreadTest.main()");
	     try {
	         Thread.sleep(5000);
	     } catch (Exception e) {
	         e.printStackTrace();
	     }
	 }
}
class Thread1 implements Runnable{
	private Map<String, String> input = new HashMap<String, String>();

	public Thread1(Map<String, String> input) {
		super();
		this.input = input;
	}

	@Override
	public void run(){
	    System.out.println(input);
	    for (Map.Entry<String, String> entry : input.entrySet()) {
	    	System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
	    }
	}
}